﻿<div ng-controller="paymentController">
	<div class="wrapper border-bottom white-bg page-heading">
		<div class="col-lg-pull-12">
			<ol class="breadcrumb">
				<li><a ui-sref="app.manage.payment">支付方式</a></li>
				<li class="active" ng-bind="breadcrumb"></li>
			</ol>
		</div>
	</div>
	<form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" role="form" novalidate>
		<div class="form-group">
			<label class="col-sm-2 control-label">通道</label>
			<div class="col-sm-3">
				<input name="channel" type="text" class="form-control input-sm" ng-model="model.channel" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">支付名称</label>
			<div class="col-sm-3">
				<input name="name" type="text" class="form-control input-sm" ng-model="model.name" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">支付时间(起)</label>
			<div class="col-sm-3">
				<input name="start_time" type="text" class="form-control input-sm" ng-model="model.start_time" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">支付时间(止)</label>
			<div class="col-sm-3">
				<input name="end_time" type="text" class="form-control input-sm" ng-model="model.end_time" required>
			</div>
		</div>
		<div class="form-group">
            <label class="col-sm-2 control-label">支付银行</label>
            <div class="col-sm-10">
                <ui-select multiple ng-model="model.bank" theme="bootstrap" title="选择银行">
                    <ui-select-match placeholder="选择银行">{{$item.name}}</ui-select-match>
                    <ui-select-choices repeat="item in banks | propsFilter: {name: $select.search}">
                        <div ng-bind-html="item.name | highlight: $select.search"></div>
                    </ui-select-choices>
                </ui-select>
            </div>
        </div>
		<div class="form-group">
			<label class="col-sm-2 control-label">单笔额度</label>
			<div class="col-sm-3">
				<input name="single_quota" type="number" class="form-control input-sm" ng-model="model.single_quota" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">单卡额度</label>
			<div class="col-sm-3">
				<input name="card_quota" type="number" class="form-control input-sm" ng-model="model.card_quota" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">是否启用</label>
			<div class="col-sm-2">
				<input name="is_open" type="checkbox" class="form-control input-sm" ng-model="model.is_open" ng-true-value="true" ng-false-value="false">
			</div>
			<label class="col-sm-2 control-label">是否进件</label>
			<div class="col-sm-2">
				<input name="is_register" type="checkbox" class="form-control input-sm" ng-model="model.is_register" ng-true-value="true" ng-false-value="false">
			</div>
			<label class="col-sm-2 control-label">可多次进件</label>
			<div class="col-sm-2">
				<input name="is_more" type="checkbox" class="form-control input-sm" ng-model="model.is_more" ng-true-value="true" ng-false-value="false">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">签约商户</label>
			<div class="col-sm-3">
				<input name="merchant_id" type="text" class="form-control input-sm" ng-model="model.merchant_id" required>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-2">
				<button type="button" class="btn btn-primary btn-sm" ng-click="add_settle()">
					<i class="fa fa-plus"></i> 新增结算
				</button>
			</div>
		</div>
		<div class="col-sm-12">
			<table class="table">
				<thead>
					<tr>
						<th width="120">编号</th>
						<th width="120">支付费率</th>
						<th width="80">结算类型</th>
						<th width="120">结算费</th>
						<th width="130">操作</th>
					</tr>
				</thead>
				<tbody ng-repeat="settle in model.settles">
					<tr>
						<td><input name="settle.code[$index]" type="text" class="form-control input-sm" ng-model="settle.code" w5c-dynamic-element required></td>
						<td><input name="settle.fee[$index]" type="number" class="form-control input-sm" ng-model="settle.fee" w5c-dynamic-element required></td>
						<td><input name="settle.settle_type" type="text" class="form-control input-sm" ng-model="settle.settle_type" w5c-dynamic-element required></td>
						<td><input name="settle.settle[$index]" type="number" class="form-control input-sm" ng-model="settle.settle" w5c-dynamic-element required></td>
						<td><a class="btn btn-primary btn-xs" ng-click="remove_settle(settle)"><i class="fa fa-trash"></i> 删除</a></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label"></label>
			<div class="col-sm-3">
				<button type="submit" w5c-form-submit="save()" class="btn btn-primary btn-sm" btn-loading="psdisabled" loading-text="保存中..." ng-disabled="psdisabled">
					<i class="fa fa-save"></i> 保存
				</button>
				<button ng-click="goBack()" class="btn btn-primary btn-sm"><i class="fa fa-rotate-left"></i> 取消</button>
			</div>
		</div>
	</form>
</div>